<div class="campaignsUpdate" ui-view="container">

    <ol class="breadcrumb">
        <li>广告中心</li>
        <li><a ui-sref="campaigns" class="tittle-color">广告投放</a></li>
        <li>广告计划修改</li>
    </ol>

    <div class="clearfix mt-10">
        <label class="title">
            <label>A</label>
            <span>{{title.advShortName}}</span>
        </label>
        <label class="title">
            <label>C</label>
            <span>{{title.campaignName}}</span>
        </label>
        <label class="title" ng-if="adCampaignVO.adStyle !== 0">
            <label>G</label>
            <span>{{codeTable[adCampaignVO.adStyle]}}</span>
        </label>
    </div>

    <form class="form-horizontal" name="mainForm" novalidate>
        <section class="fg-section">
            <h5>基本设置</h5>

            <div class="form-group" style="overflow: hidden;">
                <label class="col-sm-2 control-label">广告主：</label>
                <div class="col-sm-8">
                    <input type="text" name="shortName" class="form-control pull-left mw-300" ng-model="title.advShortName" required readonly>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">广告推广计划名称：</label>
                <div class="col-sm-8">
                    <input type="text" style="float: left" name="campaignName" class="form-control mw-300" ng-model="adCampaignVO.campaignName" required>
                    <span style="margin: 8px;display: inline-block" ng-if="!adCampaignVO.campaignName" class="cl cr"><i class="fa fa-times error" aria-hidden="true"></i>不能为空</span>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">广告形式：</label>
                <div class="col-sm-8">
                    <label class="radio-inline iw-110" ng-repeat="item in initData.adStyle">
                        <input type="radio" name="adStyle" value="{{item}}" class="magic-radio" id="{{item}}" ng-model="adCampaignVO.adStyle" ng-disabled="adStyleIsDisable">
                        <label for="{{item}}"></label>
                        {{codeTable[item]}}
                    </label>
                    <span style="margin: 8px;display: inline-block" ng-if="!adCampaignVO.adStyle" class="cl cr"><i class="fa fa-times error" aria-hidden="true"></i>不能为空</span>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">行业类型：</label>
                <div class="col-sm-8">
                    <label class="radio-inline iw-110" ng-repeat="item in initData.tradeType">
                        <input type="radio" name="tradeType" value="{{item}}" class="magic-radio" id="{{item}}" ng-model="adCampaignVO.tradeType" >
                        <label for="{{item}}"></label>
                        {{codeTable[item]}}
                    </label>
                </div>
            </div>
        </section>

        <section class="fg-section">
            <h5>时间和预期</h5>

            <div class="form-group">
                <label class="col-sm-2 control-label">广告排期1：</label>
                <div class="col-sm-8">
                    <div>
                        <ul class="list-unstyled mb-0 schedule-list">
                            <li class="clearfix" ng-repeat="item in adCampaignVO.scheduleDaysView">
                                <p class="input-group ad-scheduling">
                                    <input type="text" class="form-control" uib-datepicker-popup="yyyy-MM-dd" ng-model="item[0]" show-weeks="false" is-open="item.openedStart" datepicker-options="item.startDateOpt" close-text="关闭" clear-text="清除" current-text="今天" placeholder="开始时间" readonly>
                                    <span class="input-group-btn">
										<button type="button" class="btn btn-default" ng-click="openStart(item)">
											<i class="glyphicon glyphicon-calendar"></i>
										</button>
									</span>
                                </p>
                                <p class="pull-left form-control-static">&nbsp;~&nbsp;</p>
                                <p class="input-group ad-scheduling">
                                    <input type="text" class="form-control" uib-datepicker-popup="yyyy-MM-dd" ng-model="item[1]" show-weeks="false" is-open="item.openedEnd" datepicker-options="item.endDateOpt" close-text="关闭" clear-text="清除" current-text="今天" placeholder="结束时间" readonly>
                                    <span class="input-group-btn">
										<button type="button" class="btn btn-default" ng-click="openEnd(item)">
											<i class="glyphicon glyphicon-calendar"></i>
										</button>
									</span>
                                </p>
                                <a ng-if="$index>0" ng-click="delScheduling($index)" class="date-del">移除</a>
                                <span style="margin: 8px;display: inline-block" ng-if="!item[0] || !item[1]" class="cl cr"><i class="fa fa-times error" aria-hidden="true"></i>不能为空</span>
                            </li>
                            <li class="mb-0">
                                <p class="mb-0">
                                    <button type="button" class="btn btn-default" ng-click="addScheduling()">添加时段</button>
                                </p>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">每日时段：</label>
                <div class="col-sm-8">
                    <div style="padding-top: 5px">
                        <a class="selectAll-hand" ng-click="selectAll()" >全选</a>
                        <a class="selectAll-hand" ng-click="unSelectAll()" >反选</a>
                        <br>
                        <label class="checkbox-inline iw-80" style="margin-left: -5px;padding-left: inherit" ng-repeat="item in initData.intervalHour">
                            <input type="checkbox" name="intervalHour" value="{{item.key}}" class="magic-checkbox" id="intervalHour{{$index}}" ng-model="item.checked">
                            <label for="intervalHour{{$index}}"></label>
                            {{$index}}-{{$index + 1}}
                        </label>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">预算计价单位：</label>
                <div class="col-sm-8">
                    <div>
                        <label class="radio-inline">
                            <input type="radio" name="radioPrice" value="11" class="magic-radio" id="11" ng-model="adCampaignVO.costType" ng-disabled="costTypeIsDisable">
                            <label for="11"></label>
                            CPT
                            <small> （按天结算不限预算具实结算）</small>
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="radioPrice" value="12" class="magic-radio" id="12" ng-model="adCampaignVO.costType" ng-disabled="costTypeIsDisable">
                            <label for="12"></label>
                            CPM投放
                        </label>
                        <div class="label-input" ng-show="adCampaignVO.costType == '12'">
                            <input type="text" class="form-control" name="cpmNum" ng-pattern="/^[1-9]\d*$/" ng-model="adCampaignVO.cpmNum" ng-required="adCampaignVO.costType == '12'" ng-disabled="cpmNumIsDisable">
                        </div>
                        <label class="radio-inline ml-10" style="margin-left: 10px">
                            <input type="radio" name="radioPrice" value="13" class="magic-radio" id="13" ng-model="adCampaignVO.costType" ng-disabled="costTypeIsDisable">
                            <label for="13"></label>
                            CPC投放
                        </label>
                        <div class="label-input"  ng-show="adCampaignVO.costType == '13'">
                            <input type="text" class="form-control" name="cpcNum" ng-pattern="/^[1-9]\d*$/" ng-model="adCampaignVO.cpcNum" ng-required="adCampaignVO.costType == '13'" ng-disabled="cpcNumIsDisable">
                        </div>
                        <span style="margin: 8px;display: inline-block" ng-if="!adCampaignVO.costType" class="cl cr"><i class="fa fa-times error" aria-hidden="true"></i>不能为空</span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">预算使用策略：</label>
                <div class="col-sm-8">
                    <div>
                        <label class="radio-inline">
                            <input type="radio" name="costStrategy" value="20" class="magic-radio" id="20" ng-model="adCampaignVO.costStrategy" ng-disabled="costStrategyIsDisable">
                            <label for="20"></label>
                            预算加速使用
                            <small>（每日投放预算无上限）</small>
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="costStrategy" value="21" class="magic-radio" id="21" ng-model="adCampaignVO.costStrategy" ng-disabled="costStrategyIsDisable">
                            <label for="21"></label>
                            预算平均使用
                            <small>（每日投放预算平均使用）</small>
                        </label>
                        <span style="margin: 8px;display: inline-block" ng-if="!adCampaignVO.costStrategy" class="cl cr"><i class="fa fa-times error" aria-hidden="true"></i>不能为空</span>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">付费类型：</label>
                <div class="col-sm-8">
                    <div>
                        <label class="radio-inline">
                            <input type="radio" name="payType" value="31" class="magic-radio" id="31" ng-model="adCampaignVO.payType">
                            <label for="31"></label>
                            付费
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="payType" value="32" class="magic-radio" id="32" ng-model="adCampaignVO.payType">
                            <label for="32"></label>
                            测试
                        </label>
                        <label class="radio-inline ml-10">
                            <input type="radio" name="payType" value="30" class="magic-radio" id="30" ng-model="adCampaignVO.payType">
                            <label for="30"></label>
                            其他
                        </label>
                        <div class="label-input"  ng-show="adCampaignVO.payType == '30'">
                            <input type="text" class="form-control" style="width: 250px" name="memo" ng-model="adCampaignVO.memo" ng-required="adCampaignVO.payType == '30'">
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">广告权重：</label>
                <div class="col-sm-8">
                    <div>
                        <select  class="form-control mw-100" name="weight" ng-model="adCampaignVO.weight" ng-options="number for number in [1,2,3,4,5,6,7,8,9]">
                        </select>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">广告频次：</label>
                <div class="col-sm-8">
                    <div>
                        <label class="radio-inline">
                            <input type="radio" name="frequencyTime" value="29" class="magic-radio" id="29" ng-model="adCampaignVO.frequencyTime">
                            <label for="29"></label>
                            天
                        </label>
                        <label class="radio-inline">
                            <input type="radio" name="frequencyTime" value="28" class="magic-radio" id="28" ng-model="adCampaignVO.frequencyTime">
                            <label for="28"></label>
                            小时
                        </label><br>
                        <select class="form-control mw-100" name="frequency" ng-model="adCampaignVO.frequency" ng-options="number for number in [1,2,3,4,5,6,7,8,9,10,100]">
                        </select>
                    </div>
                </div>
            </div>
        </section>

        <section class="fg-section">
            <h5>销售和合约</h5>

            <div class="form-group">
                <label class="col-sm-2 control-label">广告销售：</label>
                <div class="col-sm-8">
                    <div>
                        <input type="text" name="salesmen" class="form-control display-ib mw-100" ng-model="adCampaignVO.salesmen">
                        <small>与销售提成直接相关</small>
                    </div>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label">广告销售单价：</label>
                <div class="col-sm-8">
                    <div>
                        <input type="text" name="unitPrice" class="form-control display-ib mw-100" ng-model="adCampaignVO.unitPrice" value="0"> 元
                        <small>与销售提成直接相关，与渠道按广告收益比例分成直接相关</small>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">广告合约：</label>
                <div class="col-sm-8">
                    <p class="form-control-static" ng-show="adCampaignVO.contractId == 0" ng-click="modelOpen(modelshortNameParam)"><a>关联</a></p>
                    <div ng-show="adCampaignVO.contractId > 0">
                        <p class="form-control-static pull-left">{{adCampaignVO.contractId}}</p>
                        <a class="btn btn-link" ng-click="modelOpen(modelshortNameParam)">关联</a>
                    </div>
                </div>
            </div>
        </section>

        <div class="text-center">
            <button type="button" class="btn btn-primary" ng-click="submit()">确定</button>
            <button type="button" class="btn ims-btn" ng-click="cancle()">取消</button>
        </div>

    </form>
</div>

<script type="text/ng-template" id="myModalContent.html">
    <div class="modal-header ng-cloak">
        <span class="modal-title">{{param.title}}</span>
        <span class="glyphicon glyphicon-remove" aria-hidden="true" ng-click="modelCancel()"></span>
    </div>
    <div class="modal-body ng-cloak">
        <div class="input-group input-group-sm">
            <input type="text" class="form-control" placeholder="搜索" ng-keyup="search($event)"  ng-model="advKeyword">
            <span class="input-group-btn">
					<button class="btn btn-default" type="button" ng-click="search()">
						<i class="glyphicon glyphicon-search"></i>
					</button>
				</span>
        </div>
        <div class="row">
            <ul class="list-unstyled advertiserList">
                <li ng-repeat="item in param.item" ng-click="modelOk($event,item)">
                    {{ item.name }}
                </li>
            </ul>
        </div>
        <s-pagination conf="paginationConf"></s-pagination>
    </div>
</script>